package com.classroommanagesystem.controller.admin;

import com.classroommanagesystem.common.Result;
import com.classroommanagesystem.domain.entity.User;
import com.classroommanagesystem.service.UserService;
import io.swagger.v3.oas.annotations.Operation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author victory
 * @date 2025/10/26 15:57
 */
@RestController("adminUserController")
@RequestMapping("/admin/user")
@Slf4j
public class UserController {
    @Autowired
    private UserService userService;

    /**
     * 根据ID获取用户信息
     * @param id
     * @return
     */
    @GetMapping("/getUserInfo/{id}")
    @Operation(summary = "根据ID获取用户信息")
    public Result<User> getUserInfo(@PathVariable Long id) {
        User user = userService.getById(id);
        return Result.success("查询成功", user);
    }

}
